import java.io.File;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Scanner;


public class DirectoryStructure {

	/**
	 * @param args
	 */
	static public String path;
	
	public DirectoryStructure(String path)
	{
		this.path=path;
		directory();
	}
	
	ArrayList<File> files=new ArrayList<File>();
	public void directory() 
	{
		File k = new File(path);
		File list[]=k.listFiles();
		UpdateDirectoryStructure(list);
		
	}
	
	/*public String toString()
	{
		//String data="";
		for(int i=0;i<files.size();i++)
		{  
			if(files.get(i).isFile()){
				//System.out.println(files.get(i).getName());
				//System.out.print(files.get(i).getAbsolutePath()+"    ");
				//System.out.print(files.get(i).length()+"   ");
				//System.out.print(files.get(i).lastModified()+"   ");
				long datetime=files.get(i).lastModified();
				Date d = new Date(datetime);
                SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
                String dateString = sdf.format(d);
                //System.out.print(dateString+"\n");
                name=files.get(i).getName();
                absolutePath=files.get(i).getAbsolutePath();
                size=files.get(i).length();
                last_modified=dateString;
			}
				//data=data+"\n"+files.get(i).getAbsolutePath();
		}	
		//return data;
	}*/
	
	private void UpdateDirectoryStructure(File list[])
	{
		for(int i=0;i<list.length;i++)
		{
			files.add(list[i]);
			if(list[i].isDirectory())
			{
				UpdateDirectoryStructure(list[i].listFiles());
			}

		}

	}	
	
	public ArrayList<File> getFiles() {
		return files;
	}
	
	/*public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		System.out.print("Enter Starting Path");//eg."F:\TV-Shows"
		String path=in.nextLine();
		DirectoryStructure test =new DirectoryStructure(path);
		//System.out.print(test.toString());
		test.toString();
	}*/

}
